<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>#{msgs.Administration_CreateUser_PageTitle}</title>
	<link rel="stylesheet" type="text/css"
		href="../themes/#{themeBean.theme}/skin.css" />
</h:head>
<h:body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="title">#{msgs.Administration_CreateUser_PageTitle}</ui:define>
		<ui:define name="manuBar">
			<h:form>
				<p:menubar autoSubmenuDisplay="true" id="menu"
					style="font-size:small">
					<p:menuitem value="#{msgs.Administration_administrationMenu_Home}" immediate="true" ajax="false"
						url="/controlling/index.xhtml" icon="ui-icon-gear"
						onstart="waiteDialog.show()" />
					
					<p:menuitem value="#{msgs.Administration_administrationMenu_AdministrationIndex}"
						url="/controlling/administration/administrationIndex.xhtml"
						icon="ui-icon-gear" immediate="true" onstart="waiteDialog.show();" />
						
					<p:menuitem value="#{msgs.Administration_administrationMenu_UserIndex}"
						url="/controlling/administration/userIndex.xhtml"
						icon="ui-icon-home" onstart="waiteDialog.show();" ajax="true" />
				</p:menubar>
			</h:form>
		</ui:define>
		<ui:define name="content">
			<h:form id="frm_createUser">
				<p:panel header="#{msgs.Administration_createUser_UserInfo}"
					style="font-size: 12px;font-style: italic;">
					<h:panelGrid columns="2">
						<h:outputText value="#{msgs.Administration_User_UserName}" />
						<p:inputText id="userName" value="#{userBean.user.userName}"
							required="true" requiredMessage="#{msgs.Administration_User_UserNameRequired}" />

						<h:outputLabel for="pwd1" value="#{msgs.Administration_User_Password}" />
						<p:password id="pwd1" value="#{userBean.user.password}"
							match="pwd2" feedback="true" label="Password 1" required="true"
							requiredMessage="#{msgs.Administration_User_PasswordRequired}"
							validatorMessage="#{msgs.Administration_User_PasswordVlidation}" />

						<h:outputLabel for="pwd2" value="#{msgs.Administration_User_ReTypePassword}" />
						<p:password id="pwd2" value="#{userBean.password}"
							label="Password 2" feedback="true" required="true"
							requiredMessage="#{msgs.Administration_User_ReTypePasswordRequired}" />

						<h:outputText value="#{msgs.Administration_User_FirstName}" />
						<p:inputText value="#{userBean.user.firstName}" required="true"
							requiredMessage="#{msgs.Administration_User_FirstNameRequired}" />

						<h:outputText value="#{msgs.Administration_User_SecondName}" />
						<p:inputText value="#{userBean.user.secondName}" required="true"
							requiredMessage="#{msgs.Administration_User_SecondNameRequired}" />

						<h:outputText value="#{msgs.Administration_User_Mobile}" />
						<p:inputText value="#{userBean.user.mobile}" required="true"
							requiredMessage="#{msgs.Administration_User_MobileRequired}" />

						<h:outputText value="#{msgs.Administration_User_Email}" />
						<p:inputText value="#{userBean.user.email}" required="true"
							validatorMessage="#{msgs.Administration_User_EmailInvalid}"
							requiredMessage="#{msgs.Administration_User_EmailRequired}">
							<f:validateRegex
								pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
						</p:inputText>

						<h:outputText value="#{msgs.Administration_User_Group}" />
						<p:selectOneMenu value="#{userBean.user.groupId}"
							style="font:small;" required="true"
							requiredMessage="#{msgs.Administration_User_GroupRequired}">
							<f:selectItem itemValue="" itemLabel="" />
							<f:selectItems value="#{groupBean.groupsList}" var="group"
								itemLabel="#{group.name}" itemValue="#{group.recid}" />
						</p:selectOneMenu>

					</h:panelGrid>
					<p:commandButton value="#{msgs.Administration_General_Save}" actionListener="#{userBean.saveUser}"
						style="height: 30px;font-size: small" onstart="waiteDialog.show()"
						oncomplete="waiteDialog.hide()" update="msg" />
					<p:commandButton value="#{msgs.Administration_General_Back}" immediate="true"
						action="#{userBean.toUserIndex}" onstart="waiteDialog.show()"
						style="height: 30px;font-size: small" />

					<p:messages id="msg" showSummary="true" />

				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>

